using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace sqengine.Components
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class CrosshairSprite : Microsoft.Xna.Framework.DrawableGameComponent
    {
        Camera _camera;
        Texture2D _crosshair;
        SpriteBatch spriteBatch;
        
        public CrosshairSprite(Game game, Camera camera, Texture2D crosshair)
            : base(game)
        {
            _camera = camera;
            _crosshair = crosshair;
            spriteBatch = new SpriteBatch(game.GraphicsDevice);
        }

      
        public override void Initialize()
        {
            base.Initialize();
        }

       
        public override void Update(GameTime gameTime)
        {
            
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            if (Enabled)
            {
                spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);
                spriteBatch.Draw(_crosshair, new Rectangle(_camera.GameViewport.Width / 2 - _crosshair.Width / 2, _camera.GameViewport.Height / 2 - _crosshair.Height / 2, _crosshair.Width, _crosshair.Height), Color.White);
                spriteBatch.End();
            }
            base.Draw(gameTime);
        }
    }
}